package com.example.demo.design_pattern.observer.impl;


import com.example.demo.design_pattern.observer.Observerable;

/**
 * @author xkx
 * @version 1.0.0
 * @datetime 2019/1/22 18:26
 * @description
 */
public class User implements Observerable {

  private String name;
  private String message;

  public User(String name) {
    this.name = name;
  }

  @Override
  public void update(String message) {
    this.message = message;
    read();
  }

  public void read() {
    System.out.println(name + " 收到推送消息： " + message);
  }
}
